package com.evan.review.architecture.components;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import com.evan.review.R;

/**
 * Jetpack组件学习主界面
 * 本Activity展示Android Jetpack组件的使用示例
 */
public class ComponentsMainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_components_main);

        // 设置标题
        setTitle("Jetpack组件学习");

        // 初始化视图
        initViews();
    }

    private void initViews() {
        // 数据绑定
        Button btnDataBinding = findViewById(R.id.btn_data_binding);
        btnDataBinding.setOnClickListener(v -> {
            startActivity(new Intent(this, DataBindingExampleActivity.class));
        });

        // LiveData
        Button btnLiveData = findViewById(R.id.btn_live_data);
        btnLiveData.setOnClickListener(v -> {
            startActivity(new Intent(this, LiveDataExampleActivity.class));
        });

        // ViewModel
        Button btnViewModel = findViewById(R.id.btn_view_model);
        btnViewModel.setOnClickListener(v -> {
            startActivity(new Intent(this, ViewModelExampleActivity.class));
        });

        // Lifecycle
        Button btnLifecycle = findViewById(R.id.btn_lifecycle);
        btnLifecycle.setOnClickListener(v -> {
            startActivity(new Intent(this, LifecycleExampleActivity.class));
        });

        // Room
        Button btnRoom = findViewById(R.id.btn_room);
        btnRoom.setOnClickListener(v -> {
            startActivity(new Intent(this, RoomExampleActivity.class));
        });

        // Navigation
        Button btnNavigation = findViewById(R.id.btn_navigation);
        btnNavigation.setOnClickListener(v -> {
            startActivity(new Intent(this, NavigationExampleActivity.class));
        });

        // WorkManager
        Button btnWorkManager = findViewById(R.id.btn_work_manager);
        btnWorkManager.setOnClickListener(v -> {
            startActivity(new Intent(this, WorkManagerExampleActivity.class));
        });

        // Paging
        Button btnPaging = findViewById(R.id.btn_paging);
        btnPaging.setOnClickListener(v -> {
            startActivity(new Intent(this, PagingExampleActivity.class));
        });
    }
} 